home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / USE.DOC < prev    next >
Text File  |  1992-03-24  |  15KB  |  413 lines

  1.    Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, use.doc, describes how to use the Ghostscript language
  23. interpreter.
  24.  
  25. For an overview of Ghostscript and a list of the documentation files, see
  26. README.  
  27.  
  28. ********
  29. ******** How to use the Ghostscript interpreter ********
  30. ********
  31.  
  32. The file name of the Ghostscript interpreter is gs.exe (MS-DOS and VMS) or
  33. gs (Unix).  To run it, you also need some external initialization files:
  34.     gconfig.ps
  35.     gs_*.ps (gs_2asc.ps, gs_ccfnt.ps, gs_dps1.ps,
  36.          gs_fonts.ps, gs_init.ps, gs_lev2.ps, gs_statd.ps)
  37.     sym__enc.ps
  38.     uglyr.gsf
  39.     Fontmap
  40. as well as any other fonts from the Ghostscript distribution (.gsf and
  41. .pfa files).
  42.  
  43. To invoke the interpreter, give the command
  44.     gs <filename1> ... <filenameN>
  45. The interpreter will read in the files in sequence and execute them.
  46. After doing this, it reads further input from the primary input stream
  47. (normally the keyboard).  Each line (i.e. characters up to a <return>) is
  48. interpreted separately.  To exit from the interpreter, type quit<return>.
  49. The interpreter also exits gracefully if it encounters end-of-file.
  50. Typing the interrupt character, e.g., control-C, is also safe.
  51.  
  52. The interpreter recognizes several switches described below, which may appear
  53. anywhere in the command line and apply to all files thereafter.
  54.  
  55. You can get a help message by invoking Ghostscript with
  56.     gs -h
  57. or
  58.     gs -?
  59. This message also lists the available devices.  For a little more
  60. information, a one-line description of each device appears near the
  61. beginning of the file devs.mak.
  62.  
  63. Choosing the output device
  64. --------------------------
  65.  
  66. Ghostscript may be built with multiple output devices.  Ghostscript
  67. normally opens the first one and directs output to it.  To use device xyz
  68. as the initial output device, include the switch
  69.     -sDEVICE=xyz
  70. in the command line.  Note that this switch must precede the first .ps
  71. file, and only its first invocation has any effect.  For example, for
  72. printer output in a normal configuration that includes an Epson printer
  73. driver, you might use the shell command
  74.     gs -sDEVICE=epson myfile.ps
  75. instead of just
  76.     gs myfile.ps
  77. Alternatively, you can type
  78.     (epson) selectdevice
  79.     (myfile.ps) run
  80. All output then goes to the printer instead of the display until further
  81. notice.  You can switch devices at any time by using the selectdevice
  82. procedure, e.g.,
  83.     (vga) selectdevice
  84. or
  85.     (epson) selectdevice
  86. As yet a third alternative, you can define an environment variable
  87. GS_DEVICE as the desired default device name.  The order of precedence for
  88. these alternatives, highest to lowest, is:
  89.     selectdevice
  90.     (command line)
  91.     GS_DEVICE
  92.     (first device in build list)
  93.  
  94. To select the density on a printer, use
  95.     gs -sDEVICE=<device> -r<xres>x<yres>
  96. For example, you can get the lowest-density (fastest) Epson mode with
  97.     gs -sDEVICE=epson -r60x60
  98. the highest-density 9-pin mode with
  99.     gs -sDEVICE=epson -r240x60
  100. and the highest-density 24-pin mode with
  101.     gs -sDEVICE=epson -r360x180
  102.  
  103. If you select a printer as the output device, Ghostscript also allows you
  104. to control where the device sends its output.  Normally, output goes
  105. directly to the printer (PRN) on MS-DOS systems, and to a scratch file on
  106. Unix or VMS systems.  To send the output to a series of files foo1.xyz,
  107. foo2.xyz, ..., use the switch
  108.     -sOUTPUTFILE=foo%d.xyz
  109. The %d is a printf format specification; you can use other formats like
  110. %02d.  Each file will receive one page of output.  Alternatively, to send
  111. the output to a single file foo.xyz, with all the pages concatenated, use
  112. the switch
  113.     -sOUTPUTFILE=foo.xyz
  114.  
  115. On Unix systems, you can send the output directly to a pipe.  To pipe the
  116. output to the command printit, use the switch
  117.     -sOUTPUTFILE=\|printit
  118.  
  119. To find out what devices are available, type
  120.     devicenames ==
  121.  
  122. File searching
  123. --------------
  124.  
  125. When looking for the initialization files (gs_*.ps), the files related to
  126. fonts, or the file for the 'run' operator, Ghostscript first tries opening
  127. the file with the name as given (i.e., using the current working directory
  128. if none is specified).  If this fails, and the file name doesn't specify
  129. an explicit directory or drive (i.e., doesn't begin with '/' on Unix
  130. systems; doesn't contain a ':' or begin with a '/' or '\' on MS-DOS
  131. systems; doesn't contain a ':' or a square bracket on VMS systems),
  132. Ghostscript will try directories in the following order:
  133.  
  134.     - The directory/ies specified by the -I switch(es) in the command
  135.       line (see below), if any;
  136.  
  137.     - The directory/ies specified by the GS_LIB environment variable,
  138.       if any;
  139.  
  140.     - The directory/ies specified by the GS_LIB_DEFAULT macro in the
  141.       Ghostscript makefile, if any.
  142.  
  143. Each of these (GS_LIB_DEFAULT, GS_LIB, and -I parameter) may be either a
  144. single directory, or a list of directories separated by a character
  145. appropriate for the operating system (':' on Unix systems, ';' on VMS
  146. systems, ';' on MS-DOS systems).
  147.  
  148. VMS-specific notes
  149. ------------------
  150.  
  151. On VMS systems, the last character of each "directory" name indicates what
  152. sort of entity the "directory" references.  If the "directory" name ends
  153. with a colon, it is taken as referring to a logical device, e.g.:
  154.         $ DEFINE GHOSTSCRIPT_DEVICE DUA1:[GHOSTSCRIPT_14]
  155.         $ DEFINE GS_LIB GHOSTSCRIPT_DEVICE:
  156. If the "directory" name ends with a closing square bracket, it is taken as
  157. referring to a real directory, e.g.:
  158.         $ DEFINE GS_LIB DUA1:[GHOSTSCRIPT]
  159.  
  160. To run Ghostscript with switches, you must type a command like
  161.  
  162.     $ gs "-dNODISPLAY"
  163.  
  164. because the C run time library will convert the command
  165. parameters/arguments to lowercase unless you enclose them in double quotes
  166. which preserves the case.
  167.  
  168. If you are on an X Windows display (for which gs is built), you can do
  169.  
  170.     $ set display/create/node="domain-name"/transport=tcpip
  171.  
  172. For example,
  173.  
  174.     $ set display/create/node="doof.city.com"/transport=tcpip
  175.  
  176. and then run Ghostscript
  177.  
  178.     $ gs
  179.  
  180. MS-DOS notes
  181. ------------
  182.  
  183. If you compiled Ghostscript with the Watcom compiler, you must insert the
  184. following line in your AUTOEXEC.BAT:
  185.  
  186.     set GS_RUN_EXE=dos4gw
  187.  
  188. If you are running Ghostscript on a MS-DOS machine with a display that is
  189. not EGA/VGA compatible, you must build Ghostscript with the BGI driver as
  190. the default, and you will need the appropriate .BGI file from the Borland
  191. Turbo C library.  (Ghostscript includes the EGA/VGA driver in the
  192. executable.)
  193.  
  194. If you are using the BGI driver, two additional environment variables
  195. become relevant:
  196.  
  197.     BGIPATH - defines the directory where Ghostscript will look for
  198. the appropriate BGI driver.  If BGIPATH is not defined, Ghostscript will
  199. look in the directory defined as BGIDIR in the makefile.  In either case,
  200. if no driver is found in the designated directory, Ghostscript will look
  201. in the current directory.
  202.  
  203.     BGIUSER - a string of the form nn.dname, where nn is a hexadecimal
  204. number giving a display mode and dname is the name of a file containing a
  205. user-supplied BGI driver.  If BGIUSER is defined and the BGI device is
  206. selected, Ghostscript will supply nn as the display mode and will obtain
  207. the driver from the file named dname.
  208.  
  209. Some applications, such as Microsoft Word, require a prologue in front of
  210. the PostScript files they output.  In the case of Word, this is one of the
  211. *.ini files included with the Word distribution.  Other applications may
  212. require other prologues.  These may be specified on the Ghostscript
  213. command line, e.g.,
  214.     gs prologue.ini myfile.ps
  215.  
  216. X Windows resources
  217. -------------------
  218.  
  219. Ghostscript looks for the following resources under the program name
  220. "Ghostscript":
  221.  
  222.     borderWidth - the border width in pixels
  223.         default = 1
  224.     borderColor - the name of the border color
  225.         default = black
  226.     geometry - the window size and placement, WxH+X+Y
  227.         default = ???
  228.     xResolution - the number of x pixels per inch
  229.         default is computed from WidthOfScreen and WidthMMOfScreen
  230.     yResolution - the number of y pixels per inch
  231.         default is computed from HeightOfScreen and HeightMMOfScreen
  232.  
  233. To set these resources, put them in a file (such as ~/.Xdefaults) in the
  234. following form:
  235.  
  236. Ghostscript*geometry:    612x792-0+0
  237. Ghostscript*xResolution: 72
  238. Ghostscript*yResolution: 72
  239.  
  240. Then load the defaults into the X server:
  241.  
  242. % xrdb -merge ~/.Xdefaults
  243.  
  244. Normal switches
  245. ---------------
  246.  
  247.     -- filename arg1 ...
  248.         Takes the next argument as a file name as usual, but takes
  249.         all remaining arguments (even if they have the syntactic
  250.         form of switches) and defines the name ARGUMENTS in
  251.         userdict (not systemdict) as an array of those strings,
  252.         *before* running the file.  When Ghostscript finishes
  253.         executing the file, it exits back to the shell.
  254.  
  255.     -Dname=token
  256.     -dname=token
  257.         Define a name in systemdict with the given definition.
  258.         The token must be exactly one token (as defined by the
  259.         'token' operator) and must not contain any whitespace.
  260.  
  261.     -Dname
  262.     -dname
  263.         Define a name in systemdict with value=null.
  264.  
  265.     -Sname=string
  266.     -sname=string
  267.         Define a name in systemdict with a given string as value.
  268.         This is different from -d.  For example,
  269.             -dname=35
  270.         is equivalent to the program fragment
  271.             /name 35 def
  272.         whereas
  273.             -sname=35
  274.         is equivalent to
  275.             /name (35) def
  276.  
  277.     -q
  278.         Quiet startup -- suppress normal startup messages,
  279.         and also do the equivalent of -dQUIET.
  280.  
  281.     -gnumber1xnumber2
  282.         Equivalent to -dDEVICEWIDTH=number1 and
  283.         -dDEVICEHEIGHT=number2.  This is for the benefit of
  284.         devices (such as X11 windows and VESA displays) that require
  285.         (or allow) width and height to be specified.
  286.  
  287.     -rnumber1xnumber2
  288.         Equivalent to -dDEVICEXRESOLUTION=number1 and
  289.         -dDEVICEYRESOLUTION=number2.  This is for the benefit of
  290.         devices (such as printers) that support multiple
  291.         X and Y resolutions.
  292.  
  293.     -Idirectories
  294.         Adds the designated list of directories at the head of the
  295.         search path for library files.
  296.  
  297.     -
  298.         This is not really a switch.  It indicates to Ghostscript
  299.         that the standard input is coming from a file or a pipe.
  300.         Ghostscript reads from stdin until reaching end-of-file,
  301.         executing it like any other file, and then continues
  302.         processing the command line.  At the end of the command
  303.         line, Ghostscript exits rather than going into its
  304.         interactive mode.
  305.  
  306. Note that gs_init.ps makes systemdict read-only, so the values of names
  307. defined with -D/d/S/s cannot be changed (although, of course, they can be
  308. superseded by definitions in userdict or other dictionaries.)
  309.  
  310. Special names
  311. -------------
  312.  
  313. -dASCIIOUT
  314.     disables Ghostscript's normal behavior; instead, writes strings to
  315. stdout that would have been displayed or printed.  For more information,
  316. see the file gs_2asc.ps.
  317.  
  318. -dDISKFONTS
  319.     causes individual character outlines to be loaded from the disk
  320. the first time they are encountered.  (Normally Ghostscript loads all the
  321. character outlines when it loads a font.)  This may allow loading more
  322. fonts into RAM, at the expense of slower rendering.
  323.  
  324. -dNOBIND
  325.     disables the 'bind' operator.  Only useful for debugging.
  326.  
  327. -dNOCACHE
  328.     disables character caching.  Only useful for debugging.
  329.  
  330. -dNODISPLAY
  331.     suppresses the normal initialization of the output device.  This
  332. may be useful when debugging.
  333.  
  334. -dNOPAUSE
  335.     disables the prompt and pause at the end of each page.  This may
  336. be desirable for applications where another program is 'driving'
  337. Ghostscript.
  338.  
  339. -dWRITESYSTEMDICT
  340.     leaves systemdict writable.  This is necessary when running
  341. special utility programs such as font2c and pcharstr, which must bypass
  342. normal PostScript access protection.
  343.  
  344. -sDEVICE=device
  345.     selects an alternate initial output device, as described above.
  346.  
  347. -sOUTPUTFILE=filename
  348.     selects an alternate output file (or pipe) for the initial output
  349. device, as described above.
  350.  
  351. Debugging switches
  352. ------------------
  353.  
  354. The -T and -Z switches only apply if the interpreter was built for a
  355. debugging configuration.
  356.  
  357.     -A    Turn on allocator debugging.
  358.  
  359.     -e    Turn on tracing of error returns from operators.
  360.  
  361.     -E    Abort when any operator returns with an error.
  362.  
  363.     -Mn    Force the interpreter's allocator to acquire additional
  364.         memory in units of nK, rather than the default (currently
  365.         20K on MS-DOS systems, 50K on Unix).  n is a positive
  366.         decimal integer (not exceeding 63 on MS-DOS systems).
  367.  
  368.     -Tname:rsize:format
  369.         (Only available on MS-DOS systems.)
  370.         Trace a procedure within Ghostscript.  Any number of
  371.         procedures may be traced.  rsize is the size of the value
  372.         returned by the procedure, in bytes; if omitted, the value
  373.         returned by the procedure is not printed.  format is a
  374.         printf-style template for printing the arguments; if
  375.         omitted, the arguments are printed in hex.  Note that
  376.         MS-DOS provides no way to quote spaces or commas within a
  377.         command line argument.
  378.  
  379.     -Zxxx    Turn on debugging printout.
  380.         Each of the xxx characters selects an option:
  381.         if the string is empty, all options are selected.
  382.         Case is significant.
  383.             0 = type 1 path tracer (type1imagepath)
  384.             1 = type 1 font interpreter (type1addpath)
  385.             2 = curve subdivider
  386.             a = allocator (large blocks only)
  387.               A = allocator (all calls)
  388.             b = bitmap image processor
  389.               B = bitmap images, detail
  390.             c = color/halftone mapper
  391.             d = dictionary lookup
  392.             f = fill algorithm (summary)
  393.               F = fill algorithm (detail)
  394.             h = halftone renderer
  395.             i = interpreter, just names
  396.               I = interpreter, everything
  397.             k = character cache
  398.               K = character cache, every access
  399.             l = command lists, bands
  400.               L = command lists, everything
  401.             m = makefont and font cache
  402.             o = outliner (stroke)
  403.             p = path tracer
  404.             q = clipping
  405.             r = arc renderer
  406.             s = scanner
  407.             t = tiling algorithm
  408.             u = undo saver (for save/restore)
  409.             v = rectangle fill
  410.               V = device-level output
  411.             w = LZW encoder/decoder
  412.             x = transformations
  413.